#!/bin/bash
mydir=`dirname "$0"`
uninstallToolPath="$mydir/UninstallerTool"
installBasePath="${2%/Red Giant Warp}"
installSubPath="Red Giant Warp"
payloadFile="${PACKAGE_PATH}/../../Resources/Payloads/Glow.glow.9168def2.pax.gz"
productName="Warp"
productNumber="112"
installProductStr=`/usr/bin/grep -i "\<${productName}\>" "/tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_${productNumber}"`
if [ ! -z "${installProductStr}" ]; then
    /usr/bin/xattr -d com.apple.quarantine "${payloadFile}"
    /bin/mkdir -p "$2/${installSubPath}"
    pushd "$2/${installSubPath}"
    /bin/pax -rzf "${payloadFile}"
    popd
    "$uninstallToolPath" -a "keying" "Keying Suite" -a "keying.warp" "Warp" -a "keying.warp.AdobeCC" "Warp for Adobe CC" "${installBasePath}/${installSubPath}/RadiumGlow.plugin" "${installBasePath}/${installSubPath}/RadiumGlowEdge.plugin" "${installBasePath}/${installSubPath}/RadiumGlowLite.plugin" "${installBasePath}/Red Giant Warp"
fi
